yjx.controller('orderListController',['$rootScope','$scope','ipCookie','$timeout','$fetch','modalService',function ($rootScope,$scope,ipCookie,$timeout,$fetch,modalService) {
    var myOrderListApi = '';
    var saleOrderListApi = '/order/getOrders';
    $rootScope.tabCtrlName = $rootScope.tabCtrlNameArr[3];
    $scope.orderTags = ['sale','my']
    if($rootScope.identity == 1){
        $scope.orderTag = $scope.orderTags[0];
    }else{
        $scope.orderTag = $scope.orderTags[1];
    }

    function getOrders() {
        $fetch.fetch(
            "/order/myOrders",
            {
                params:{
                    userId:$rootScope.userId
                },
                cache:false,
            }
        ).then(function (data) {
            $timeout(function(){
                if(data){
                    $scope.mySaleOrders = data.inviterOrders;
                    $scope.myOrders = data.myOrders;
                    $scope.totalBrokerage = data.mybrokerage;
                    //console.log($scope.myOrders)
                }
            })

        }).catch(function (e) {
                modalService.mainMsgError(e.msg);
        })
    }

    if($rootScope.userId){
        getOrders();
    }

    }])